import { axios } from '../http/request'

export const getSong = () => {
    return axios({
        url: '/api/search?keywords=海阔天空',
        method: 'get'
    })
}

// 获取每日推荐歌曲(要登录) /recommend/songs
export const getRecommendSongs = () => {
    return axios({
        url: '/api/recommend/songs',
        method: 'get'
    })
}


// 热门话题 /hot/topic?limit=30&offset=30

export const getHotTopicData = () => {
    return axios({
        // url: '/api/hot/topic?limit=3',
        url: '/topic.json',
        method: 'get'
    })
}
// 话题详情 /topic/detail?actid=111551188

// 获取话题详情热门动态 /topic/detail/event/hot?actid=111551188


// 推荐歌单 /personalized?limit=30
export const getRecommendSongListData = () => {
    return axios({
        url: '/api/personalized?limit=12',
        method: 'get'
    })
}

// 所有榜单 /toplist
export const getRankSongListData = () => {
    return axios({
        url: '/api/toplist',
        method: 'get'
    })
}

// 榜单详情 /toplist/detail

// 获取歌单（排行榜也是歌单的一种）中的歌曲 /playlist/track/all?id=19723756&limit=10&offset=1

// 热门电台 /dj/hot

// 电台个性推荐 /dj/personalize/recommend

// 热门歌单分类 /playlist/hot
export const getHotSongListCategoryData = () => {
    return axios({
        url: '/api/playlist/hot',
        method: 'get',
    })
}

// 获取歌单详情 /playlist/detail?id=24381616
export const getHotSongListDetailData = (id: number | undefined) => {
    return axios({
        url: `/api/playlist/detail?id=${id}`,
        method: 'get',
    })
}

// 获取歌单内的歌曲 /playlist/track/all?id=24381616&limit=10&offset=1
export const getHotSongListData = (id: number) => {
    return axios({
        url: `/api/playlist/track/all?id=${id}&limit=10&offset=1`,
        method: 'get',
    })
}

// 通过歌曲id获取歌曲url /song/url?id=33894312
export const getSongUrlData = (id: number) => {
    return axios({
        url: `/api/song/url?id=${id}`,
        method: 'get',
    })
}

// 通过歌曲id获取歌词 /lyric?id=1983290040
export const getLyricsData = (id: number) => {
    return axios({
        url: `/api/lyric?id=${id}`,
        method: 'get',
    })
}

// 通过歌曲id判断音乐是否可用 /check/music?id=33894312
export const getSongIsPlayData = (id: number) => {
    return axios({
        url: `/api/check/music?id=${id}`,
        method: 'get',
    })
}

// 喜欢音乐 /like?id=347230
export const getLikedMusicData = (id: number) => {
    return axios({
        url: `/api//like?id=${id}`
    })
}